﻿using System;

namespace Elvex
{
    public class Ticker
    {
        private Action<float> CallBack
        {
            get;
            set;
        }

        public Ticker(Action<float> callback)
        {
            CallBack = callback;
            UpdateManager.AddTicker(this);
        }

        ~Ticker()
        {

            UpdateManager.RemoveTicker(this);
        }

        public void Update( float delta)
        {
            CallBack?.Invoke(delta);
        }
    }
}
